knitr::opts_chunk$set(echo = TRUE) library(pwr)
a. Make use of the rbinom()
function to show you can reproduce both probabilities. (1 point)
A <- replicate(10000,rbinom(1,20,.05)) hist(A) length(A[A > 0])/10000 A<-rbinom(10000,20,.05) length(A[A > 0])/10000 A<-rbinom(10000,50,.05) length(A[A > 0])/10000 ?rbinom
b. If the ineffectual experiment was conducted 20 times, and there were four groups, and the experimenter would accept a significant result from any of the orthogonal linear contrasts, what would be the probability of finding a significant result here? (1 point)
The next two questions draw a connection to a technique we have not yet discussed called p-curve analysis. P-curve analysis is sometimes used for purposes of meta-analyses to determine whether there is "good" evidence for an effect in the literature.
t_results <- replicate(10000,t.test(rnorm(10,0,1),rnorm(10,0,1), var.equal = TRUE)$p.value) hist(t_results)
t_results <- replicate(10000,t.test(rnorm(200,0,1),rnorm(200,0.5,1), var.equal = TRUE)$p.value) hist(t_results)
Bonus Questions
Same as #3, except that we now assume the design has four groups (between-subjects). Assume that group A has a mean that is .5 standard deviations larger than groups B, C, and D. Use R to create a sampling distribution of p-values that would be expected for the linear contrast evaluating the research hypothesis that A > B = C = D. (1 point)
Consider a one-factor between subjects ANOVA with four groups. Run two simulations of the null-hypothesis, one for the omnibus test, and one for the specific linear contrast mentioned above A > B = C = D. Is the probability of rejecting a type I error (for rejecting the null with alpha < .05) the same for the omnibus test versus a specific contrast? (1 point)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.